1. Field of the Invention
The present invention relates to hardware graphics accelerators.
2. State of the Art
The relative complexity of rendering a graphical image, whether on a computer display or on a printed page, has resulted in the development of a number of different graphical xe2x80x9clanguagesxe2x80x9d. Some of these languages, for example Printer Control Language (PCL), are primarily applicable to producing hard copy. Other xe2x80x9cpage descriptionxe2x80x9d languages are applicable to both displaying images on a computer screen and printing images on print media. For example, in a Macintosh computer, a graphics library known as xe2x80x9cQuickDrawxe2x80x9d, part of the Macintosh Operating System, may be used to produce images on screen or off screen. Similarly, in PC-compatible computers, the Windows operating system provides drawing routines in the form of a Graphics Device Interface library which is used for imaging all complex graphic operations either on or off screen. For purposes of describing the present invention, reference will be made to QuickDraw; it should be understood, however, that the invention is and will be applicable to a wide variety of graphical languages.
QuickDraw converts graphics commands from a higher-level application program for presentation on a video screen or for printing on print media. QuickDraw provides a graphics library built into every Macintosh computer, and is described more fully in INSIDE MACINTOSH, Imaging With QuickDraw, published by Apple Computer, Inc., which is incorporated herein by reference.
QuickDraw defines some clear mathematical constructs that are widely used in its procedures, functions and data types. The most basic QuickDraw type is the point which consists of two integers for specifying a horizontal and vertical position in a coordinate plane. Other types are lines, rectangles, ovals, arcs, rounded-corner rectangles, polygons, and regions. Many drawing operations consist of filling or framing these objects with a pattern. QuickDraw also supports drawing text in multiple fonts in various sizes and styles. In present day computers, QuickDraw draws by altering a bit image in an area of memory, the frame buffer in the case of screen display and the print buffer in the case of printed output.
QuickDraw allows a number of separate drawing areas called GrafPorts to be defined. Each GrafPort has its own complete drawing environment that defines how and where graphic operations will have their effect. Many GrafPorts can be open at once and each one will have its own coordinate system, drawing pattern, background pattern, pen size and location, character font and style, etc. GrafPorts are fundamental to the Macintosh""s overlapping window user interface. One GrafPort may be designated as the printer GrafPort in order to draw a page for printing.
Each GrafPort has a rectangle, called the portRect, which defines the area for use by the GrafPort Each GrafPort also has its own clipping region which can be used to further limit drawing to any subset of the GrafPorts""s portRect. Each GrafPort has a drawing pen which is used for drawing lines, shapes, and text. The pen has four characteristics: a location, a size, a drawing mode, and a drawing pattern. The pen mode and pen pattern determine how the bits xe2x80x9cunderxe2x80x9d the pen are affected as the pen xe2x80x9cmoves overxe2x80x9d them when drawing lines and shapes. Each GrafPort also has its own text font, style, mode and size for drawing text within the GrafPort.
There are five different drawing operations for drawing different image shapes, namely, frame, paint, erase, invert and fill. Each of the shape-drawing operations can be applied to rectangles, regions, ovals arcs, rounded-comer rectangles and polygons. In addition, QuickDraw provides routines to draw text and to perform bit-copy operations.
For each shape that QuickDraw can produce, there are separate procedures that perform the basic graphic operations to produce that shape: frame, paint, erase, invert and fill. Each of these procedures in turn calls a low-level internal QuickDraw routine for the shape to actually perform the drawing. For example, The FrameOval, PaintOval, EraseOval, InvertOval and FillOval procedures in QuickDraw actually call a single low-level routine within QuickDraw which performs these operations on ovals. There are also low-level procedures for drawing text, lines, and for performing bitcopy operations. Low-level routines are also called bottleneck procedures, which may be regarded as graphics primitives. The main QuickDraw bottleneck procedures are: StdText, StdLine, StdBits, StdRect, StdRRect, StdOval, StdPoly and StdRgn.
In the past, QuickDraw routines have been implemented in software. As a result, the computer""s CPU has been burden by the need to handle large volumes of display data and print data.
Hardware graphics accelerators are well-known and are widely-available for computers running the Windows operating system. Accelerator boards are also available for computers running under the Macintosh operating system. Such boards, although they may off-load certain task, possibly including graphics tasks, from the motherboard CPU, nevertheless execute those tasks in software. There has not been available a hardware graphics accelerator for computers running under the Macintosh operating system, i.e., a QuickDraw graphics accelerator.
Furthermore, in known hardware graphics accelerators, the hardware graphics accelerator has access only to data stored in the computer""s frame buffer, composed of (at least in higher-performance computers) video random access memory, or VRAM. The hardware graphics accelerator has not had access to data stored in the computer""s main memory, composed of (typically) dynamic random access memory, or DRAM. In many instances, a graphic object is located in DRAM and is to be manipulated using graphic routines. In accordance with the prior art, the CPU must then intervene to transfer the graphic object from DRAM to VRAM in order for the hardware graphics accelerator to be able to access the data.
Moreover, conventional hardware graphics accelerators, since they deal only with VRAM, which is never cached, do not have facilities for dealing with cacheable data so as to maintain cache coherency.
The present invention, generally speaking, provides a hardware graphics accelerator for use in a computer system having a data processor, a system bus, and a memory subsystem including both main memory and video memory. The hardware graphics accelerator includes a datapath controller connected to the system bus and to the memory subsystem for receiving data from the memory subsystem, performing an operation upon the data, and returning the data to the memory subsystem; and a memory controller connected to the system bus, to the datapath controller, and to the memory subsystem for controlling the memory subsystem such that at one time the datapath controller receives the data from the main memory and at another time the datapath controller receives the data from the video memory. In accordance with a further aspect of the invention, the hardware graphics accelerator includes circuitry for maintaining cache coherency when the system includes either a level-one cache only or both a level-one and a level-two cache.